var app = getApp()
Component({
  properties: {
    attribute: {
      type: Object,
      value: {},
    },
    spec: {
      type: Array,
      value: [],
    },
    productSelect: {
      type: Object,
      value: {
        image: '',
        name: '',
        price: 0,
        id: '',
        stock: 0,
      },
    },
    select: {
      type: String,
      value: '',
    },
  },
  data: {},
  created: function () {},
  attached: function () {},
  ready: function () {},
  methods: {
    close: function () {
      this.triggerEvent('myevent', {
        window: false,
      })
    },
    CartNumDes: function () {
      this.triggerEvent('ChangeCartNum', false)
    },
    CartNumInt: function () {
      this.triggerEvent('ChangeCartNum', true)
    },
    tapAttr: function (e) {
      console.log(e)
      var index = e.currentTarget.dataset.index
      var select = this.data.spec[index]
      console.log(this.data.spec)
      console.log(this.select)
      this.setData({
        select: select,
      })
      this.triggerEvent('ChangeAttr', select)
    },
    // ResetAttr: function () {
    //   for (var k in this.data.spec) this.data.spec[k] = ''
    //   this.setData({
    //     spec: this.data.spec,
    //   })
    // },
  },
})
